package gui;
import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
import java.awt.Color;
import java.awt.GridBagLayout;
import javax.swing.JPanel;
import javax.swing.JLabel;
import java.awt.Rectangle;
import java.awt.Font;
import java.sql.SQLException;

import com.sun.rowset.CachedRowSetImpl;

import flexibility.CachedRowSetTableModel;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import javax.swing.table.DefaultTableModel;

public class AddAssignmentGUI extends JPanel{

	public JComboBox comboBox;
	public JButton btnAdd;
	public JButton btnReturn;
	public JLabel lblNoValid;
	public JLabel lblCid;
	public AddAssignmentGUI() {
		super();
		initialize();

}
     private void initialize() {
     	this.setSize(900,600);
     	this.setBackground(UIManager.getColor("InternalFrame.activeTitleBackground"));
    	SpringLayout springLayout = new SpringLayout();
		setLayout(springLayout);
		
		JPanel panel = new JPanel();
		panel.setBackground(UIManager.getColor("InternalFrame.activeTitleBackground"));
		springLayout.putConstraint(SpringLayout.NORTH, panel, 10, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.WEST, panel, 56, SpringLayout.WEST, this);
		springLayout.putConstraint(SpringLayout.SOUTH, panel, 399, SpringLayout.NORTH, this);
		springLayout.putConstraint(SpringLayout.EAST, panel, 842, SpringLayout.WEST, this);
		add(panel);
		SpringLayout sl_panel = new SpringLayout();
		panel.setLayout(sl_panel);
		
		JLabel lblSelectFromThe = new JLabel("Select from the list the task you want to add and then click the Add");
		sl_panel.putConstraint(SpringLayout.WEST, lblSelectFromThe, 138, SpringLayout.WEST, panel);
		lblSelectFromThe.setFont(new Font("Tahoma", Font.BOLD, 15));
		panel.add(lblSelectFromThe);
		
		comboBox = new JComboBox();
		sl_panel.putConstraint(SpringLayout.SOUTH, lblSelectFromThe, -43, SpringLayout.NORTH, comboBox);
		sl_panel.putConstraint(SpringLayout.WEST, comboBox, 425, SpringLayout.WEST, panel);
		sl_panel.putConstraint(SpringLayout.SOUTH, comboBox, 200, SpringLayout.NORTH, panel);
		comboBox.setFont(new Font("Tahoma", Font.PLAIN, 14));
		sl_panel.putConstraint(SpringLayout.NORTH, comboBox, 168, SpringLayout.NORTH, panel);
		sl_panel.putConstraint(SpringLayout.EAST, comboBox, -178, SpringLayout.EAST, panel);
		panel.add(comboBox);

		comboBox.addItemListener(new java.awt.event.ItemListener() {
			public void itemStateChanged(java.awt.event.ItemEvent e) {
				System.out.println("itemStateChanged()"); 
				
				
			
				}
			
		});
		
		
		btnAdd = new JButton("Add");
		sl_panel.putConstraint(SpringLayout.WEST, btnAdd, 308, SpringLayout.WEST, panel);
		sl_panel.putConstraint(SpringLayout.SOUTH, btnAdd, -96, SpringLayout.SOUTH, panel);
		btnAdd.setFont(new Font("Tahoma", Font.BOLD, 14));
		panel.add(btnAdd);
		
		btnReturn = new JButton("return");
		btnReturn.setFont(new Font("Tahoma", Font.BOLD, 14));
		
		sl_panel.putConstraint(SpringLayout.WEST, btnReturn, 49, SpringLayout.WEST, panel);
		sl_panel.putConstraint(SpringLayout.SOUTH, btnReturn, -38, SpringLayout.SOUTH, panel);
		panel.add(btnReturn);
		
		lblNoValid = new JLabel("Not valid");
		sl_panel.putConstraint(SpringLayout.NORTH, lblNoValid, 6, SpringLayout.SOUTH, btnAdd);
		sl_panel.putConstraint(SpringLayout.EAST, lblNoValid, 0, SpringLayout.EAST, btnAdd);
		lblNoValid.setVisible(false);
		lblNoValid.setIcon(new ImageIcon(AddAssignmentGUI.class.getResource("/com/sun/java/swing/plaf/windows/icons/Error.gif")));
		lblNoValid.setForeground(Color.RED);
		panel.add(lblNoValid);
		
		JLabel lblCourseid = new JLabel("courseID:");
		lblCourseid.setForeground(Color.BLUE);
		sl_panel.putConstraint(SpringLayout.NORTH, lblCourseid, 24, SpringLayout.NORTH, panel);
		sl_panel.putConstraint(SpringLayout.WEST, lblCourseid, 27, SpringLayout.WEST, panel);
		panel.add(lblCourseid);
		
		lblCid = new JLabel("cid");
		sl_panel.putConstraint(SpringLayout.NORTH, lblCid, 24, SpringLayout.NORTH, panel);
		sl_panel.putConstraint(SpringLayout.WEST, lblCid, 21, SpringLayout.EAST, lblCourseid);
		sl_panel.putConstraint(SpringLayout.EAST, lblCid, 82, SpringLayout.EAST, lblCourseid);
		lblCid.setForeground(Color.BLUE);
		panel.add(lblCid);
    }
}
